package com.papper.common.enums;

/**
 * @Author:Lajiao
 * @Date:2014年7月14日
 * @Time:下午3:49:44
 * @Description:数据状态定义
 */
public enum ProductEnum {
    P1000("1000", "商户交易"),
    P1001("1001", "商户会员购买"),
    P1002("1002", "商户升级代理商"),
    P1003("1003", "商户分润提现"),
    P1004("1004", "代理分润提取"),
    P1005("1005", "系统分润提现"),
    P1006("1006", "钱包充值提现"),
    P1007("1007", "话费充值消费"),
    P3001("3001", "重复补空单");

    private String code;
    private String name;

    ProductEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static String getName(String code) {
        if (code == null) {
            return "";
        }
        for (ProductEnum re : ProductEnum.values()) {
            if (re.getCode().equals(code)) {
                return re.getName();
            }
        }
        return "";
    }

    public static String getCode(String name) {
        if (name == null) {
            return null;
        }
        for (ProductEnum re : ProductEnum.values()) {
            if (name.equals(re.getName())) {
                return re.getCode();
            }
        }
        return null;
    }
}
